package com.fdb.efp.cus.service.impl;

import java.util.List;
import java.util.Objects;

import com.fdb.efp.cus.service.dao.CusT07BlacklistTempDao;
import com.fdb.efp.cus.service.domain.CusT07BlacklistTemp;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.fdb.basic.framework.core.base.FrameworkService;
import com.fdb.efp.cus.service.facade.CusT07BlacklistTempService;
import com.fdb.efp.cus.service.vo.CusT07BlacklistTempVO;


/**
 * Service Impl: 反洗钱黑名单临时表服务实现
 * @author ligm
 * @date 2019-05-29 
 */
@Service("cusT07BlacklistTempService")
public class CusT07BlacklistTempServiceImpl implements CusT07BlacklistTempService, FrameworkService {
	
	private static Logger logger = LoggerFactory.getLogger(CusT07BlacklistTempServiceImpl.class);

	@Autowired
	private CusT07BlacklistTempDao cusT07BlacklistTempDao;

   	/**
	 * 新增数据 
     * @param inCusT07BlacklistTempVo
     * @return 
	 */
	public int insertCusT07BlacklistTemp(CusT07BlacklistTempVO inCusT07BlacklistTempVo) {
		logger.debug("当前新增数据为:"+ inCusT07BlacklistTempVo.toString());
		int num = 0;
		try {
			CusT07BlacklistTemp cusT07BlacklistTemp = new CusT07BlacklistTemp();
			beanCopy(inCusT07BlacklistTempVo, cusT07BlacklistTemp);
			num = cusT07BlacklistTempDao.insertCusT07BlacklistTemp(cusT07BlacklistTemp);
		} catch (Exception e) {
			logger.error("新增数据发生异常!", e);
			num = -1;
		}
		logger.debug("当前新增数据条数为:"+ num);
		return num;
	}

    /**
	 * 根据主键删除信息 
	 * @param inCusT07BlacklistTempVo
 	 * @return
	 */
	public int deleteByPk(CusT07BlacklistTempVO inCusT07BlacklistTempVo) {
		logger.debug("当前删除数据条件为:"+ inCusT07BlacklistTempVo);
		int num = 0;
		try {
			CusT07BlacklistTemp cusT07BlacklistTemp = new CusT07BlacklistTemp();
			beanCopy(inCusT07BlacklistTempVo, cusT07BlacklistTemp);
			num = cusT07BlacklistTempDao.deleteByPk(cusT07BlacklistTemp);
		} catch (Exception e) {
			logger.error("删除数据发生异常!", e);
			num = -1;
		}
		logger.debug("根据条件:"+ inCusT07BlacklistTempVo +"删除的数据条数为"+ num);
		return num;
	}


    /**
	 * 根据主键更新信息 
	 * @param inCusT07BlacklistTempVo
	 * @return 
	 */  
	public int updateByPk(CusT07BlacklistTempVO inCusT07BlacklistTempVo) {
		logger.debug("当前修改数据为:"+ inCusT07BlacklistTempVo.toString());
		int num = 0;
		try {
			CusT07BlacklistTemp cusT07BlacklistTemp = new CusT07BlacklistTemp();
			beanCopy(inCusT07BlacklistTempVo, cusT07BlacklistTemp);
			num = cusT07BlacklistTempDao.updateByPk(cusT07BlacklistTemp);
		} catch (Exception e) {
			logger.error("修改数据发生异常!", e);
			num = -1;
		}
		logger.debug("根据条件:"+ inCusT07BlacklistTempVo +"修改的数据条数为"+ num);
		return num;
	}
	
    /**
	 * 根据主键查询详情 
	 * @param cusT07BlacklistTemp
	 * @return 
	 */
	public CusT07BlacklistTempVO queryByPk(CusT07BlacklistTempVO inCusT07BlacklistTempVo) {
		
		logger.debug("当前查询参数信息为:"+ inCusT07BlacklistTempVo);
		try {
			CusT07BlacklistTemp queryCusT07BlacklistTemp = new CusT07BlacklistTemp();
			beanCopy(inCusT07BlacklistTempVo, queryCusT07BlacklistTemp);
			CusT07BlacklistTemp queryRslCusT07BlacklistTemp = cusT07BlacklistTempDao.queryByPk(queryCusT07BlacklistTemp);
			if (Objects.nonNull(queryRslCusT07BlacklistTemp)) {
				CusT07BlacklistTempVO outCusT07BlacklistTempVo = beanCopy(queryRslCusT07BlacklistTemp, new CusT07BlacklistTempVO());
				logger.debug("当前查询结果为:"+ outCusT07BlacklistTempVo.toString());
				return outCusT07BlacklistTempVo;
			} else {
				logger.debug("当前查询结果为空!");
			}
		} catch (Exception e) {
			logger.error("查询数据发生异常!", e);
		}
		return null;
	}


    /**
	 * 一级数据权限 
	 * @param cusT07BlacklistTemp
	 * @return 
	 */	
	@SuppressWarnings("unchecked")
	public List<CusT07BlacklistTempVO> queryAllByLevelOne(CusT07BlacklistTempVO cusT07BlacklistTempVo) {
		logger.debug("查看当前用户对应的数据信息的参数信息为:");
		List<CusT07BlacklistTempVO> list = null;
		try {
			List<CusT07BlacklistTemp> cusT07BlacklistTemps = cusT07BlacklistTempDao.queryAllByLevelOneByPage(cusT07BlacklistTempVo);
			logger.debug("查看当前用户对应的数据信息的结果集数量为:"+ cusT07BlacklistTemps.size());
			pageSet(cusT07BlacklistTemps, cusT07BlacklistTempVo);
			list = (List<CusT07BlacklistTempVO>) beansCopy(cusT07BlacklistTemps, CusT07BlacklistTempVO.class);
		} catch (Exception e) {
			logger.error("数据转换出现异常!", e);
		}
		
		return list;
	
	}


    /**
	 * 二级数据权限 
	 * @param cusT07BlacklistTemp
	 * @return 
	 */
	@SuppressWarnings("unchecked")
	public List<CusT07BlacklistTempVO> queryAllByLevelTwo(CusT07BlacklistTempVO cusT07BlacklistTempVo) {
		logger.debug("查看当前用户及所属机构对应的数据信息的参数信息为:");
		List<CusT07BlacklistTemp> cusT07BlacklistTemps = cusT07BlacklistTempDao.queryAllByLevelTwoByPage(cusT07BlacklistTempVo);
		logger.debug("查看当前用户及所属机构对应的数据信息的结果集数量为:"+cusT07BlacklistTemps.size());
		List<CusT07BlacklistTempVO> list = null;
		try {
			pageSet(cusT07BlacklistTemps, cusT07BlacklistTempVo);
			list = (List<CusT07BlacklistTempVO>) beansCopy(cusT07BlacklistTemps, CusT07BlacklistTempVO.class);
		} catch (Exception e) {
			logger.error("数据转换出现异常!", e);
		}
		
		return list;
	
	}


    /**
	 * 三级数据权限 
	 * @param cusT07BlacklistTemp
	 * @return 
	 */
	@SuppressWarnings("unchecked")
	public List<CusT07BlacklistTempVO> queryAllByLevelThree(CusT07BlacklistTempVO cusT07BlacklistTempVo) {
		logger.debug("查看当前用户所在机构及下属机构对应的数据信息的参数信息为:");
		List<CusT07BlacklistTemp> cusT07BlacklistTemps = cusT07BlacklistTempDao.queryAllByLevelThreeByPage(cusT07BlacklistTempVo);
		logger.debug("查看当前用户所在机构及下属机构对应的数据信息的结果集数量为:"+ cusT07BlacklistTemps.size());
		List<CusT07BlacklistTempVO> list = null;
		try {
			pageSet(cusT07BlacklistTemps, cusT07BlacklistTempVo);
			list = (List<CusT07BlacklistTempVO>) beansCopy(cusT07BlacklistTemps, CusT07BlacklistTempVO.class);
		} catch (Exception e) {
			logger.error("数据转换出现异常!", e);
		}
		
		return list;
	}

    /**
	 * 四级数据权限  
	 * @param cusT07BlacklistTemp
	 * @return 
	 */
	@SuppressWarnings("unchecked")
	public List<CusT07BlacklistTempVO> queryAllByLevelFour(CusT07BlacklistTempVO cusT07BlacklistTempVo) {
		logger.debug("【预留，便于后续自定义 】信息的参数信息为:");
		List<CusT07BlacklistTemp> cusT07BlacklistTemps = cusT07BlacklistTempDao.queryAllByLevelFourByPage(cusT07BlacklistTempVo);
		logger.debug("【预留，便于后续自定义 】信息的结果集数量为:"+ cusT07BlacklistTemps.size());
		List<CusT07BlacklistTempVO> list = null;
		try {
			pageSet(cusT07BlacklistTemps, cusT07BlacklistTempVo);
			list = (List<CusT07BlacklistTempVO>) beansCopy(cusT07BlacklistTemps, CusT07BlacklistTempVO.class);
		} catch (Exception e) {
			logger.error("数据转换出现异常!", e);
		}
		
		return list;
	}

    /**
	 * 五级数据权限  
	 * @param cusT07BlacklistTemp
	 * @return 
	 */
	@SuppressWarnings("unchecked")
	public List<CusT07BlacklistTempVO> queryAllByLevelFive(CusT07BlacklistTempVO cusT07BlacklistTempVo) {
		logger.debug("【预留，便于后续自定义 】信息的参数信息为:");
		List<CusT07BlacklistTemp> cusT07BlacklistTemps = cusT07BlacklistTempDao.queryAllByLevelFiveByPage(cusT07BlacklistTempVo);
		logger.debug("【预留，便于后续自定义 】信息的结果集数量为:"+ cusT07BlacklistTemps.size());
		List<CusT07BlacklistTempVO> list = null;
		try {
			pageSet(cusT07BlacklistTemps, cusT07BlacklistTempVo);
			list = (List<CusT07BlacklistTempVO>) beansCopy(cusT07BlacklistTemps, CusT07BlacklistTempVO.class);
		} catch (Exception e) {
			logger.error("数据转换出现异常!", e);
		}
		
		return list;
	}

	@Override
	public List<CusT07BlacklistTempVO> queryAll() {
		logger.debug("【预留，便于后续自定义 】信息的参数信息为:");
		List<CusT07BlacklistTemp> cusT07BlacklistTemps = cusT07BlacklistTempDao.queryAll();
		logger.debug("【预留，便于后续自定义 】信息的结果集数量为:"+ cusT07BlacklistTemps.size());
		List<CusT07BlacklistTempVO> list = null;
		try {
			list = (List<CusT07BlacklistTempVO>) beansCopy(cusT07BlacklistTemps, CusT07BlacklistTempVO.class);
		} catch (Exception e) {
			logger.error("数据转换出现异常!", e);
		}
		
		return list;
	}
}
